package cn.cdeden.knowledge.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.*;
//import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;

import java.io.Serializable;
import java.util.Date;

/**
* @author GW
* @date 2024-01-19
*/
@Data
@Builder
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@TableName("sys_log_perm")
public class SysLogPerm implements Serializable {
    private static final long serialVersionUID = 1L;

    @TableId(type= IdType.AUTO)
    private Long id;

//    @ApiModelProperty(value = "日志编号")
    private Long logId;

//    @ApiModelProperty(value = "对象id")
    private Long objectId;

//    @ApiModelProperty(value = "对象类型")
    private Integer objectType;

//    @ApiModelProperty(value = "团队角色id")
    private String teamRoleId;

//    @ApiModelProperty(value = "类型")
    private String type;

//    @ApiModelProperty(value = "权限")
    private String perm;

//    @ApiModelProperty(value = "创建编号")
    @TableField(fill= FieldFill.INSERT)
    private String createId;

//    @ApiModelProperty(value = "创建者")
    @TableField(fill= FieldFill.INSERT)
    private String createBy;

    public SysLogPerm(Long objectId, int objectType, String perm, String teamRoleId) {
        this.objectId = objectId;
        this.objectType = objectType;
        this.perm = perm;
        this.teamRoleId = teamRoleId;
    }

//    @ApiModelProperty(value = "创建日期")
    @TableField(fill= FieldFill.INSERT)
    private Date createTime;


    public void copyFrom(SysLogPerm source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
